$(function(){
	$('.am-datepicker-months tbody tr td span').on('click',function(){
			$('.Iclose').datepicker('close');
		})
	console.log(1)
	var arr;
	$.ajax({
		url: "/assets/json/AccountChecking.json",
		dataType: "json",
		success: function(res) {
			console.log(res)
			arr = res.data;
			var a;
			var money = 0;
			for(var i = 0; i < arr.length; i++) {

				var item = res.data[i];
				
				
				
				a += `<tr class="gradeX">
							<td>${item.time}</td>
							<td>${item.company}</td>
							<td>${item.ordernumber}</td>
							<td>${item.ordermomey}</td>
							<td>${item.status}</td>
							<td>${item.KDorderid}</td>
							
							<td>
								<div class="tpl-table-black-operation">
									<a class="DZD">
										<i class="am-icon-pencil"></i> 对账单
									</a>
									<a class="KDD">
										<i class="am-icon-pencil"></i> 快递单
									</a>
								</div>
							</td>
						</tr>`;
				
			}
href=""
			$('#tablea tbody').html(a);
			$('.DZD').on('click',function(){
				var idx=$(this).parent().parent().parent().index()
				window.location.href="/admin/Finance/AccountCheckingdetails?statusid="+arr[idx].statusid; 
			})
			$('.KDD').on('click',function(){
				var idx=$(this).parent().parent().parent().index()
				if(arr[idx].statusid==1){
					layer.open({
					content: '快递单号:<input type="text"/>',
					btn: ['确定']
					})
				}else{
					layer.open({
					content: '请确认订单',
					btn: ['确定']
					})
				}
			})
		}
	})
	
	
})
